package com.jack.payment.constant.enums;

import com.jack.payment.entity.common.BusinessException;

/**
 * 登录类型枚举
 */
public enum LoginMethodEnum {
    EMAIL(0),       // 邮箱
    PHONE(1),       // 手机
    TWO_FA(2),      // 2fa 验证方式
    QQ(3)
    ;

    private Integer value;

    public Integer getValue() {
        return value;
    }
    LoginMethodEnum(Integer value) {
        this.value = value;
    }

    public static LoginMethodEnum getAppointLoginMethod(Integer source) throws BusinessException {
        if(source != null) {
            for (LoginMethodEnum loginMethodEnum : values()) {
                if (source == loginMethodEnum.getValue()) {
                    return loginMethodEnum;
                }
            }
        }
        throw new BusinessException();
    }
}
